package com.css.entity;

import java.util.HashSet;

/**
 * <p>
 * -
 * </p>
 *
 * @author css
 * @since 2019/1/10
 */
public class KeyMapWrapper {
    private final static HashSet<Integer> keys = new HashSet<>();

    public static boolean put(Integer key) {
        return keys.add(key);
    }

    public static boolean isPress() {
//        System.out.println(keys.size());
        return keys.size() > 0;
    }

    public static HashSet<Integer> getKeys() {
        return keys;
    }

    public static Integer size() {
        return keys.size();
    }

    public static boolean isHas(Integer key) {
        return keys.contains(key);
    }

    public static boolean isHas(Integer... key) {
        for (Integer integer : key) {
            if (!keys.contains(integer)) {
                return false;
            }
        }
        return true;
    }

    public static void remove(Integer key) {
//        System.out.println("抬起" + KeyBorderCode.HASH_MAP.get(key));
        if (key == KeyBorderCode.ALT) {
            keys.clear();
        }
        keys.remove(key);
    }
}
